//
//  ChapterCell.swift
//  Spookiness
//
//  Created by 腾億 on 2017/12/18.
//  Copyright © 2017年 tml. All rights reserved.
//

import UIKit

class ChapterCell: UICollectionViewCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.contentView.addSubview(self.nameLB)
        setUpSnap()
        self.contentView.addBorder(width: 1, color: UIColor.lightGray.withAlphaComponent(0.5))
        self.contentView.layer.cornerRadius = 5
    }
    
    fileprivate lazy var nameLB: UILabel = {
       let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 16)
        return label
    }()
    
    fileprivate func setUpSnap() {
        self.nameLB.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsetsMake(0, 10, 0, 10))
        }
    }
    
    var model: ChapterSatticModel? {
        didSet {
            guard let model = model else {
                return
            }
            self.nameLB.text = model.name
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
